home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 1.iso / dist / fw_qt.idb / usr / freeware / include / qmainwindow.h.z / qmainwindow.h
C/C++ Source or Header  |  2001-04-12  |  6KB  |  175 lines

  1. /****************************************************************************
  2. ** $Id: qt/src/widgets/qmainwindow.h   2.3.0   edited 2001-01-26 $
  3. **
  4. ** Definition of QMainWindow class
  5. **
  6. ** Created : 980316
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QMAINWINDOW_H
  39. #define QMAINWINDOW_H
  40.  
  41. #ifndef QT_H
  42. #include "qwidget.h"
  43. #endif // QT_H
  44.  
  45. #ifndef QT_NO_MAINWINDOW
  46.  
  47. class QMenuBar;
  48. class QStatusBar;
  49. class QToolTipGroup;
  50. class QToolBar;
  51. template <class type> class QList;
  52.  
  53. class QMainWindowPrivate;
  54.  
  55. class Q_EXPORT QMainWindow: public QWidget
  56. {
  57.     Q_OBJECT
  58.     Q_PROPERTY( bool rightJustification READ rightJustification WRITE setRightJustification )
  59.     Q_PROPERTY( bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps )
  60.     Q_PROPERTY( bool usesTextLabel READ usesTextLabel WRITE setUsesTextLabel )
  61.     Q_PROPERTY( bool toolBarsMovable READ toolBarsMovable WRITE setToolBarsMovable )
  62.     Q_PROPERTY( bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving )
  63.  
  64. public:
  65.     QMainWindow( QWidget * parent = 0, const char * name = 0, WFlags f = WType_TopLevel );
  66.     ~QMainWindow();
  67.  
  68. #ifndef QT_NO_MENUBAR
  69.     QMenuBar * menuBar() const;
  70. #endif
  71.     QStatusBar * statusBar() const;
  72.     QToolTipGroup * toolTipGroup() const;
  73.  
  74.     virtual void setCentralWidget( QWidget * );
  75.     QWidget * centralWidget() const;
  76.  
  77.     // ##### In moved to Qt:: in 3.0 and qtoolbar doesn't #include qmainwindow,
  78.     // ##### then qmainwindow can include qtoolbar, so toolBars() below can
  79.     // ##### work in bad compilers.
  80.     enum ToolBarDock {
  81.     Unmanaged, TornOff, Top, Bottom, Right, Left, Minimized
  82.     };
  83.  
  84.     virtual void setDockEnabled( ToolBarDock dock, bool enable );
  85.     bool isDockEnabled( ToolBarDock dock ) const;
  86.     void setDockEnabled( QToolBar *tb, ToolBarDock dock, bool enable ); // ########### make virtual
  87.     bool isDockEnabled( QToolBar *tb, ToolBarDock dock ) const;
  88.  
  89.     void addToolBar( QToolBar *, ToolBarDock = Top, bool newLine = FALSE );
  90.     void addToolBar( QToolBar *, const QString &label,
  91.              ToolBarDock = Top, bool newLine = FALSE );
  92.     void moveToolBar( QToolBar *, ToolBarDock = Top );
  93.     void moveToolBar( QToolBar *, ToolBarDock, bool nl, int index, int extraOffset = -1 );
  94.  
  95.     void removeToolBar( QToolBar * );
  96.  
  97.  
  98.     void show();
  99.     QSize sizeHint() const;
  100.     QSize minimumSizeHint() const;
  101.  
  102.     bool rightJustification() const;
  103.     bool usesBigPixmaps() const;
  104.     bool usesTextLabel() const;
  105.     bool toolBarsMovable() const;
  106.     bool opaqueMoving() const;
  107.  
  108.     bool eventFilter( QObject*, QEvent* );
  109.  
  110.     bool getLocation( QToolBar *tb, ToolBarDock &dock, int &index, bool &nl, int &extraOffset ) const;
  111.  
  112. // WARNING: compilers requiring Q_TEMPLATE_NEEDS_CLASS_DECLARATION
  113. //        may not be supported in future Qt versions.
  114. #ifndef Q_TEMPLATE_NEEDS_CLASS_DECLARATION
  115.     QList<QToolBar> toolBars( ToolBarDock dock ) const;
  116. #endif
  117.     void lineUpToolBars( bool keepNewLines = FALSE );
  118.  
  119.     bool isDockMenuEnabled() const;
  120.  
  121. public slots:
  122.     virtual void setRightJustification( bool );
  123.     virtual void setUsesBigPixmaps( bool );
  124.     void setUsesTextLabel( bool ); // virtual 3.0
  125.     void setToolBarsMovable( bool ); // virtual 3.0
  126.     void setOpaqueMoving( bool ); // virtual 3.0
  127.     void setDockMenuEnabled( bool );
  128.  
  129.     void whatsThis();
  130.  
  131. signals:
  132.     void pixmapSizeChanged( bool );
  133.     void usesTextLabelChanged( bool );
  134.     void startMovingToolBar( QToolBar * );
  135.     void endMovingToolBar( QToolBar * );
  136.     void toolBarPositionChanged( QToolBar * );
  137.  
  138. protected slots:
  139.     virtual void setUpLayout();
  140.  
  141. protected:
  142.     void paintEvent( QPaintEvent * );
  143.     void resizeEvent( QResizeEvent * );
  144.     void childEvent( QChildEvent * );
  145.     bool event( QEvent * );
  146.     void styleChange( QStyle& );
  147.  
  148. private:
  149.     QMainWindowPrivate * d;
  150.     void triggerLayout( bool deleteLayout = TRUE);
  151.     void moveToolBar( QToolBar *, QMouseEvent * );
  152.     void rightMouseButtonMenu( const QPoint &p );
  153.  
  154. #ifndef QT_NO_MENUBAR
  155.     virtual void setMenuBar( QMenuBar * );
  156. #endif
  157.     virtual void setStatusBar( QStatusBar * );
  158.     virtual void setToolTipGroup( QToolTipGroup * );
  159.     ToolBarDock findDockArea( const QPoint &pos, QRect &rect, QToolBar *tb, QRect *dockRect = 0 );
  160.     void moveToolBar( QToolBar *, ToolBarDock, QToolBar *relative, int ipos );
  161.  
  162.     friend class QToolBar;
  163.     friend class QMenuBar;
  164.     friend class QHideDock;
  165. private:    // Disabled copy constructor and operator=
  166. #if defined(Q_DISABLE_COPY)
  167.     QMainWindow( const QMainWindow & );
  168.     QMainWindow& operator=( const QMainWindow & );
  169. #endif
  170. };
  171.  
  172. #endif // QT_NO_MAINWINDOW
  173.  
  174. #endif // QMAINWINDOW_H
  175.